using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Collections.Specialized;

namespace Xid.Controls
{
    public partial class LabelTextboxCtrl : UserControl
    {


        public AutoCompleteStringCollection AutoCompleteCustomSource
        {
            get
            {
                return this.textBox.AutoCompleteCustomSource;
            }
        }

        public string Label
        {
            get { return label.Text; }
            set { label.Text = value; }
        }

        [Bindable(true, BindingDirection.TwoWay)]
        public string Value
        {
            get { return this.textBox.Text; }
            set { this.textBox.Text = value; }
        }


        private string toolTip;

        public string ToolTip
        {
            get { return toolTip; }
            set
            {
                toolTip = value;
                toolTip1.SetToolTip(textBox, value);
            }
        }


        public bool ReadOnly
        {
            get { return this.textBox.ReadOnly; }
            set { this.textBox.ReadOnly = value; }
        }

        public LabelTextboxCtrl()
        {
            InitializeComponent();
            this.textBox.TextChanged += new EventHandler(textBox_TextChanged);
        }

        void textBox_TextChanged(object sender, EventArgs e)
        {
            OnValueChanged();
        }

        public event EventHandler ValueChanged;
        protected virtual void OnValueChanged()
        {
            if (this.ValueChanged != null)
                this.ValueChanged(this, new EventArgs());
        }
    }
}
